<!doctype html>
<html class="no-js" lang="en">
<!--<![endif]-->
<head>
<meta name="layout" content="common">
<title>Manage Merchants</title>

</head>
<body id="body">
	<h2>Manage Merchants - <g:if test="${merchantInstance.id }">Update</g:if><g:else>Create</g:else></h2>
	<hr />

	<div class="row>">
		<g:form name="UpdateMerchant" method="POST" action="update">
			<g:hiddenField name="id" value="${merchantInstance?.id}" />
			<g:hiddenField name="version" value="${merchantInstance?.version}" />
			<g:hiddenField name="searchCondition" value="${searchCondition}"/>
			<g:hiddenField name="prevAction" value="${prevAction}"/>
			<table width="100%">
				<tr>
					<td width="30%">Name&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="name" value="${merchantInstance.name}" maxLength="100" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${merchantInstance}" field="name" /></span>
					</td>
				</tr>
				<tr>
					<td>Country&nbsp;<font color="red">*</font></td>
					<td>
						<g:select name="country" from="${countryList.name}" keys="${countryList.id}" value="${merchantInstance?.country?.id}" />
						<span class="errorMsg"><br/><g:fieldError bean="${merchantInstance}" field="country" /></span>
					</td>
				</tr>
				<tr>
					<td>Categories&nbsp;<font color="red">*</font></td>
					<td>
						<g:select name="categories" from="${catList.name}" multiple="multiple" keys="${catList.id}" size="5" value="${merchantInstance?.categories*.id}" />
						<span class="errorMsg"><br/><g:fieldError bean="${merchantInstance}" field="categories" /></span>
					</td>
				</tr>
				<tr>
					<td>Description</td>
					<td>
						<g:textArea name="description" value="${merchantInstance.description}" rows="5" style="resize: none; width: 220px;"></g:textArea>
						<span class="errorMsg"><br/><g:fieldError bean="${merchantInstance}" field="description" /></span>
					</td>
				</tr>
				<tr>
					<td>Contact&nbsp;<font color="red">*</font></td>
					<td>
						<g:textField name="contact" value="${merchantInstance.contact}" maxLength="20" style="width:220px;"/>
						<span class="errorMsg"><br/><g:fieldError bean="${merchantInstance}" field="contact" /></span>
					</td>
				</tr>
				<tr>
					<td>Logo</td>
					<td>
						<g:textField name="logo" value="${merchantInstance.logo}" maxLength="255" style="width:220px;"/>&nbsp;&nbsp;
						<g:img id="logo_img" uri="${merchantInstance.logo }" height="36" width="36" />
						<span class="errorMsg"><br/><g:fieldError bean="${merchantInstance}" field="logo" /></span>
					</td>
				</tr>
				<tr>
					<td>Address</td>
					<td>
						<g:textField name="address" value="${merchantInstance.address}" maxLength="255" style="width:220px;"/>
					</td>
				</tr>
				<tr>
					<td>Status&nbsp;<font color="red">*</font></td>
					<td>
						<g:select name="status" from="${com.mastercard.labs.Merchant$Status?.values()}" keys="${com.mastercard.labs.Merchant$Status.values()*.name()}" value="${fieldValue(bean:merchantInstance,field:'status')}"/>
						<span class="errorMsg"><br/><g:fieldError bean="${merchantInstance}" field="status" /></span>
					</td>
				</tr>
				<tr><td>&nbsp;</td></tr>
				<tr>
					<td></td>
					<td>
						<g:actionSubmit action="save" value="Save" class="btn btn-primary" />
						<g:if test="${merchantInstance.id }"><g:actionSubmit action="delete" value="Delete" class="btn btn-warning" onclick="return confirm('Are you sure want to delete this record?');" /></g:if>
						<g:actionSubmit action="search" value="Cancel" class="btn" onclick="return confirm('Any changes made will be lost without saving. Are you sure you want to cancel?');" />
					</td>
				</tr>
			</table>
		</g:form>
	</div>
	<script src="${resource(dir:'js/app', file:'merchant_update.js') }"></script>
</body>
</html>
